from django.conf.urls import url
from django.urls import re_path

from blogSystem1 import views

app_name = 'blogsystem'

urlpatterns = [
    url(r'^$', views.home, name='home'),

    url(r'^login/$', views.login, name='login'),

    url(r'^register/$', views.register, name='register'),

    url(r'^logout/', views.logout, name='logout'),

    url(r'^get_validcode_img/', views.get_validcode_img, name='get_validcode_img'),

    # 后台管理
    url(r'^cn_backend/$', views.cn_backend, name='cn_backend'),

    url(r'^cn_backend/add_article/$', views.add_article, name='add_article'),

    # 添加文章上传文件处理
    url(r'^upload_img_add_article/$', views.upload_img_add_article, name='upload_img_add_article'),

    # 个人站点url
    re_path(r'^(?P<username>\w+)/$', views.home_site),

    # 标签 分类 时间分类的跳转路由设计
    re_path(r'^(?P<username>\w+)/(?P<condition>tag|category|archive)/(?P<param>.*)/$', views.home_site),

    # 个人文章站点
    re_path(r'^(?P<username>\w+)/articles/(?P<article_id>\d+)/$', views.article_site),

    # 删除文章
    re_path(r'^cn_backend/delete/(?P<article_id>\d+)/$', views.article_delete),

]
